package mt.comm;

import java.io.Serializable;

import mt.Order;

public class ClientSideMessageClass implements ClientSideMessage, Serializable{

    private Type type;
    private Order order;
    private String nickname;
    private String error;
    
    public ClientSideMessageClass(Type type, Order order, String nickname, String error){
		this.type = type;
		this.order = order;
		this.nickname = nickname;
		this.error = error;
	}
    
    public ClientSideMessageClass orderMessage(String nickname, Order order) {
        ClientSideMessageClass message = new ClientSideMessageClass(Type.ORDER, order, order.getNickname(), null);
        return message;
    }
    
    public ClientSideMessageClass errorMessage(String nickname, String error) {
    	ClientSideMessageClass message = new ClientSideMessageClass(Type.ERROR, null, nickname, null);
        return message;
    }
    
    @Override
    public Type getType() {
            // TODO Auto-generated method stub
            return type;
    }

    @Override
    public Order getOrder() {
            // TODO Auto-generated method stub
            return order;
    }

    @Override
    public String getError() {
            // TODO Auto-generated method stub
            return error;
    }

}